﻿using Abp.Dependency;
using Abp.Domain.Entities;
using Mall.DomainModel.Dto.Query;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Mall.DomainModel.IRepository.RepositoryProgram
{
    public interface IRepository<TEntity, TPrimaryKey> : IRepository, ITransientDependency where TEntity : class, IEntity<TPrimaryKey>
    {
        Task<IEnumerable<TEntity>> GetAllListAsync();

        Task<TEntity> GetAsync(TPrimaryKey id);

        Task<TEntity> FirstOrDefaultAsync(TPrimaryKey id);

        Task<TEntity> InsertAsync(TEntity entity);

        Task<TPrimaryKey> InsertAndGetIdAsync(TEntity entity);

        Task<TEntity> UpdateAsync(TEntity entity);

        Task<int> CountAsync(IQueryObject<TEntity> query);

        Task<Tuple<int, IList<TEntity>>> GetListAsync(IQueryObject<TEntity> query);
    }
}
